Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/long

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/long

TypeScript definitions for long.js

  • 4.0.2
  • ts3.9
  • ts4.0
  • ts4.1
  • ts4.2
  • ts4.3
  • ts4.4
  • ts4.5
  • ts4.6
  • ts4.7
  • ts4.8
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/long?

The @types/long package provides TypeScript type definitions for the long.js library, which is a comprehensive library for working with 64-bit integers. These type definitions enable TypeScript developers to use long.js in their projects with the benefits of TypeScript's static type checking. The long.js library itself allows for the representation, manipulation, and serialization of 64-bit integers, which are not natively supported in JavaScript due to its use of IEEE 754 floating-point numbers for all numeric values.

What are @types/long's main functionalities?

Creating long integers

This feature allows the creation of 64-bit integers. The code sample demonstrates how to create a long integer with the maximum signed positive value.

import * as Long from 'long';
let longVal = new Long(0xFFFFFFFF, 0x7FFFFFFF);

Arithmetic operations

This feature enables arithmetic operations such as addition, subtraction, multiplication, and division on 64-bit integers. The code sample shows how to add two Long instances.

import * as Long from 'long';
let longOne = Long.fromInt(1);
let longTwo = Long.fromInt(2);
let sum = longOne.add(longTwo);

Comparison

This feature allows for the comparison of long integers, including equality checks and relational comparisons. The code sample demonstrates checking if two Long instances are equal.

import * as Long from 'long';
let longOne = Long.fromInt(1);
let longTwo = Long.fromInt(2);
let isEqual = longOne.equals(longTwo);

Serialization

This feature supports the serialization of long integers to strings, which is useful for storage or transmission. The code sample shows how to serialize a Long instance to a string.

import * as Long from 'long';
let longVal = Long.fromInt(123456);
let serialized = longVal.toString();

Other packages similar to @types/long

FAQs

Package last updated on 26 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc